<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 <html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">
 <base href="<%=basePath%>">
   <title>用户信息</title>
  <jsp:include page="bs/bs.jsp"></jsp:include>
  <style type="text/css">

.form-signin {
  max-width: 400px;
  margin: 0 auto;
}.form-group {
    margin-bottom: 1px;
}

  </style>
  <script type="text/javascript">

	  // 更新预约状态函数
	  function upYyzt(oid,zt,type){

      //获取 预约日期 传到后台
      		var odate = $("#" + oid + "").text();

  		$.ajax({
  			url:"${pageContext.request.contextPath}/upYyzt",
  			data:{"type":type,"oid":oid,"zt":zt,"odate":odate},
  			type:"get",
  			success:function(d){
  				if(d==1){
  				    //页面刷新   重新加载页面
  					location.href="/showOrder";
  				}
  				if(d==0 && type==3){
  					alert("取消预约失败,当天只能取消1次，一周只能取消2次");
  				}
  				if(d==0 && type==1){
  					alert("作废失败");
  				}
  				if(d==0 && type==2){
  					alert("付款失败");
  				}
  				if(d==0 && type==4){
  					alert("操作失败");
  				}
  			}
  			
  		});
  		
  	}
  
  </script>
  </head>
<!-- NAVBAR
================================================== -->
  <body>
    <c:if test="${empty u }">
  	<c:redirect url="login.jsp"></c:redirect>
  </c:if>

	<jsp:include page="common/top.jsp"></jsp:include>


    <div class="container" >
    	<h1>${u.ui.drealname }<small>${u.ui.dsex==1?'男':'女' }</small></h1>
    	年龄：${u.ui.dage }<br>
    	手机号：${u.ui.dphone }<br>
    	身份证号：${u.ui.didcard}<br>
    	邮箱：${u.ui.demail }<br>
    	QQ：${u.ui.dqq }<br>
    	<form action="${pageContext.request.contextPath}/showOrder" >
    	<button type="submit" class="btn btn-primary" >点击查询我的预约</button>
    	</form>
    </div>
    <div class="container">
    	<table class="table table-hover">
    		<th>医生姓名</th>
    		<th>预约日期</th>
    		<th>预约时间</th>
    		<th>挂号费</th>
    		<th>预约状态</th>
    		<th>操作</th>
    		<c:if test="${!empty os }">
    			<c:forEach items="${os }" var="o">
    				<tr>
    					<td>${o.ename }</td>
    					
    					<td>
    					<span id="${o.oid}"><fmt:formatDate value="${o.odate }" pattern="yyyy-MM-dd"/> </span>
    					</td>
    					<td>${o.sjd }</td>
    					<td>${o.ghf }</td>
    					<td>${o.yyzt }</td>
    					<td>
    						<c:if test="${o.yyztid==21 }">
    							<a href="javascript:upYyzt(${o.oid},25,1)">取消</a>
    							<a href="javascript:upYyzt(${o.oid},22,2)">付款</a>
    						</c:if>
    						<c:if test="${o.yyztid==22 }">
    							<a href="javascript:upYyzt(${o.oid },23,3)">取消</a>
    							<a href="javascript:upYyzt(${o.oid },24,4)">完成</a>
    						</c:if>
    						<c:if test="${o.yyztid==24 }">
    							<a href="toComm?oid=${o.oid }">评论</a>
    						</c:if>
    					</td>
    				</tr>
    			</c:forEach>
    		</c:if>
    	
		</table>
    
    </div>
  </body>
</html>

